﻿using System;
using System.ServiceModel;
using SilenthinkContract.Domain;
using System.Collections.Generic;

namespace SilenthinkContract
{
    [ServiceContract(Namespace = ServiceContract.Namespace)]
    public interface IPassportService : IService
    {
        #region User

        [OperationContract]
        bool CreateUser(User o);

        [OperationContract]
        bool UpdateUser(User o);

        [OperationContract]
        bool DeleteUser(long id);

        [OperationContract]
        User GetUser(long id);

        [OperationContract]
        PageList<User> GetPagedUser(string username = null, UserStatus? status = null, int index = 1, int size = 20);

        [OperationContract(Name = "GetUserWidthDetails")]
        User GetUser(long id, bool inclProfile = false, bool inclExtra = false);

        [OperationContract(Name = "GetUserByUsername")]
        User GetUser(string username);

        [OperationContract(Name = "GetUserByUsernamePassword")]
        User GetUser(string name, string password);

        [OperationContract]
        User GetUserByMobile(string mobile);

        [OperationContract]
        bool ExistUserGuid(Guid guid);

        [OperationContract]
        bool ExistUserName(string username);

        [OperationContract]
        bool ExistBindingEmail(string email);

        [OperationContract]
        bool ExistBindingMobile(string mobile);

        [OperationContract]
        bool EmailBinding(long userId, string email);

        [OperationContract]
        bool MobileBinding(long userId, string mobile);

        [OperationContract]
        bool ChangePassword(long userId, string newPassword);

        //[OperationContract(Name = "ChangePasswordByEmail")]
        //bool ChangePassword(string email, string newPassword);
        [OperationContract]
        UserProfile GetUserProfile(long id);

        [OperationContract]
        bool UpdateUserProfile(UserProfile o);

        [OperationContract]
        IList<OAuthConfig> GetOAuthConfigs(bool? status = null);

        #endregion

        #region UserAddress

        [OperationContract]
        UserAddress GetUserAddress(int id, long? userId=null);

        [OperationContract]
        IList<UserAddress> GetUserAddresses(long userId);

        [OperationContract]
        bool CreateUserAddress(UserAddress address);

        [OperationContract]
        bool UpdateUserAddress(UserAddress address);

        [OperationContract]
        bool DeleteUserAddress(int id, long? userId = null);

        [OperationContract]
        bool SetDefaultUserAddress(int id, long userId);

        #endregion

        #region UserInvoice

        [OperationContract]
        UserInvoice GetUserInvoice(int id, long? userId = null);

        [OperationContract]
        IList<UserInvoice> GetUserInvoices(long userId);

        [OperationContract]
        bool CreateUserInvoice(UserInvoice address);

        [OperationContract]
        bool UpdateUserInvoice(UserInvoice address);

        [OperationContract]
        bool DeleteUserInvoice(int id, long? userId = null);

        [OperationContract]
        bool SetDefaultUserInvoice(int id, long userId);

        #endregion
    }
}